package com.generator;

import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;

import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: DHF
 * @Date: 2018/12/27 0027 21:43
 * @Description:
 */
public class Generator {
	public static void main(String[] args) throws IOException, XMLParserException, SQLException, InterruptedException, InvalidConfigurationException {


		List<String> strings = new ArrayList<String>();
		File configFile = new File("src//resource//generatorConfig.xml");
		ConfigurationParser cp = new ConfigurationParser(strings);
		Configuration config = cp.parseConfiguration(configFile);
		DefaultShellCallback callback = new DefaultShellCallback(true);
		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, strings);
		myBatisGenerator.generate(null);
		System.out.print("----FINISH----");

	}



}
